Repository navigation
Move Kibana with its cluster's version, after every node (S-024-9) - #612
Conversation
A change of the Elasticsearch service's version now moves Kibana in the same converge instead of refusing it. Before Kibana's held package changes, the role reads every node's version (GET /_nodes) and, while one is older than the declared version, leaves Kibana as it is and reports the refusal, which the services converge answers with PRECONDITION (service_kibana_node_older). Kibana then restarts on the new version and the converge waits until it reports itself available, its saved objects migrated. A Kibana at the declared version reads nothing more, so a second converge stays changed=0. Fixes #579 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Verdict: MERGE. No fix commits; reviewed head 8105ce9.
Rebase onto origin/main: no-op, no conflicts; changelog_guard check exits 0.
Checks run locally: ruff, mypy, ansible-lint engine/ansible (CI's ANSIBLE_CONFIG), config validate --project config/examples, pytest on engine/tests and sdk/tests test_s024_* plus test_s023_rabbitmq_cluster.py: 122 passed. Full suite left to CI.
What holds: versions compare numerically (9.2.10 after 9.2.9), malformed or prerelease versions are refused; with one of two nodes old the converge stops before any task changes the host; a Kibana at the declared version and a dry run read no node; the refusal reaches the CLI as PRECONDITION, only for projects with Kibana; the cloudfall password stays out of -vvv output.
Unverified live (stand-ins only): the APT move of the held package, the saved-object migration within the 10-minute wait, the dashboard opening afterwards, a real Elasticsearch 9 GET /_nodes answer.
Findings not fixed (all nits):
- F-1
filter_plugins/kibana_nodes.py:31: a declared node missing from theGET /_nodesanswer is not refused, so Kibana can move ahead of a node that is down. Elasticsearch won't let an older node rejoin a cluster of newer ones, and a run including that node fails anyway. Follow-up: compare againstelasticsearch.nodeson a move - F-2
tasks/main.yml:146: the comment says every node is read; only the answering ones are - F-3
tasks/version.yml:9: a failed node read shows only a no_log result, with no plain hint (same as the existing credentials read) - F-4 the guide's version-change section is not written yet (guide arrives with #613, the rest with #582)
History: H-1 consistent, H-3 consistent, H-4 consistent, H-11 unrelated, H-12 no overlapping lines.
Plan
engine/ansible/roles/cloudfall_kibana/tasks/version.yml(new),engine/ansible/roles/cloudfall_kibana/filter_plugins/kibana_nodes.py(new),engine/ansible/roles/cloudfall_kibana/tasks/main.yml,engine/ansible/roles/cloudfall_kibana/defaults/main.yml,engine/ansible/roles/cloudfall_kibana/meta/argument_specs.yml,engine/ansible/playbooks/services.yml,sdk/src/cloudfall/lifecycle.py,engine/tests/test_s024_9_kibana_version_change.py(new),sdk/tests/test_s024_9_kibana_version_precondition.py(new),engine/tests/test_s024_kibana_role.py,changelog.d/579-kibana-version-change.mdversion.ymlreads every node's version (GET /_nodes) and, while one is older than the declared version, reports the refusal and stops before the install (spec 024, Version); (3)services.ymlhands the Kibana role the report directory andrun_services_playbookpasses it for a project with Kibana, so the converge answersPRECONDITION; (4) the held package moves through the pinned install, and the existing restart and wait for "available" cover the saved-object migration; (5) tests, changelog fragmentengine/tests/test_s024_9_kibana_version_change.pyrunsversion.ymlfor real withansible-playbookagainst a stand-in node of a cluster of two (one node old: refused with the report andPRECONDITION; both new: passes withchanged=0), and reads the task order of the role and the plays ofservices.yml;sdk/tests/test_s024_9_kibana_version_precondition.pyproves the services converge answers the reported refusal with its code; S-024-4 and S-024-5 stay proved by the existing testsengine/tests/test_s024_kibana_role.py: the task "Refuse a Kibana of another version than the Elasticsearch service's" asserted an older Kibana is refused, which S-024-9 replaces with moving it; the test now names the renamed task and asserts a newer one is refused, and its list of read-only tasks before the install gains the node checkSummary
Builds S-024-9 of spec 024: Kibana follows a change of its cluster's version, after every node.
cloudfall_kibana/tasks/version.yml, included frommain.ymlwhen the installed Kibana differs from the declared version, never in check mode): the role readsGET /_nodes?filter_path=nodes.*.name,nodes.*.versionfrom its node as thecloudfallaccount (no_log), with the node's CA whenremoteAccessis declared. A new filter,cloudfall_kibana_older_nodes, names each node older than the declared version and refuses an answer it can't read (no node, a node without a name, a version not of the form9.2.4). When one is older, the role writes arefusedreport (service_kibana_node_older, the nodes and versions behind) to the directory the MariaDB and RabbitMQ roles report to, and fails withPRECONDITION service_kibana_node_older: ...before any task changes the host. Kibana's package is left as it isPRECONDITION:run_services_playbooknow hands the report directory to a project with a Kibana service too, so the refusal reaches the command as its code and message, as the RabbitMQ majority refusal does.cloudfall-engine playbook run services.ymlalready passes it for every services runallow_change_held_packages) moves it to the new version; the hold stays. The restart it notifies starts the new version, and the existing wait forGET /api/statusto reportavailable(up to 10 minutes) covers the saved-object migration, followed by the existing check that Kibana reports the declared versionservices.ymlalready runs after every node this run converges (Kibana service: Kibana converged on a node, with its token and keys (S-024-3, S-024-4, S-024-5) #569); the node read also catches a node outside the run (--limit, or a node left behind)Test notes
engine/tests/test_s024_9_kibana_version_change.py(17 tests): the filter on several cluster answers and on malformed ones; the include coming right before the install and its condition (a new version and a first install read the nodes, Kibana at the declared version and a dry run do not); the install, hold, restart flush, wait and version check in that order;services.ymlhanding the role the report directory; a newer or another-major Kibana refused; andversion.ymlrun for real withansible-playbook -vvv --diffagainst a stand-in node answeringGET /_nodesforh1andh2with basic auth:h2on 9.2.4 stops withPRECONDITION, writes the report namingh2 9.2.4alone, sends one GET, and the password is in no output; both on 9.2.5 pass withchanged=0and no reportsdk/tests/test_s024_9_kibana_version_precondition.py(2 tests): a converge of a project with Kibana passes the report directory, and a reported refusal comes back asLifecycleErrorwith codeservice_kibana_node_older, which the command answers withPRECONDITIONspecs.py coverage --spec 024lists tests for S-024-9ruff check .,mypy,ansible-lint engine/ansible(withANSIBLE_CONFIG=engine/ansible/ansible.cfg, as CI),cloudfall config validate --project config/examples, andpyteston the new files plusengine/tests/test_s024_kibana_role.py,test_s024_kibana_access.py,test_s024_8_kibana_domain.py,test_s024_kibana_render.py,test_role_handlers_load.py,sdk/tests/test_s024_kibana_converge.py,test_s023_rabbitmq_cluster.py,test_s019_mariadb_replication.py. The full suite is left to CIUnverified live (needs Debian 13 hosts with Elastic's packages):
kibanapackage, Kibana's saved-object migration finishing within the wait, and the dashboard of S-024-6 opening afterwardsGET /_nodesanswer on a real cluster of two with one node on the old versionFixes #579
🤖 Generated with Claude Code